var lbt_list=[{src:"img/sl1.jpg",title:"【19天】第60集：见一，妈妈来接你了"},{src:"img/sl2.jpg",title:"《18不限》我本宇直，奈何周围腐眼多……"},
	{src:"img/sl3.jpg",title:"《狼的报恩》腹黑律师在线讨论纯情大佬"},{src:"img/sl4.jpg",title:"《酷大叔的恋爱物语》戏精怂包少女VS冷酷凶恶大叔"},{src:"img/sl5.jpg",title:"《妖妖切克闹 》妖妖切克闹！我说神鸟你说要！"},{src:"img/sl1.jpg",title:"【19天】第60集：见一，妈妈来接你了"}]
	
$.each(lbt_list,function(i,e){
	$("<li></li>").html('<img src="'+e.src+'"><span class="banner-title">'+e.title+'</span>').appendTo($(".lbt"))

})
	// 轮播图
	var i=0;
	function Banner(t){
		if(t){
			i=i+t;
		}
		if(i==6){
			$(".lbt").stop().animate({"margin-left":"0px"},0);
			i=1;
		}
		if(i==-1){
			$(".lbt").stop().animate({"margin-left":"480px"},0);
			i=5;
		}
		$(".lbt").stop().animate({"margin-left":-480*i+"px"},1000);
		// $(".dot").$("#cricle>li").eq(i%6).css("background","#f60").siblings().css("background","rgba(255,255,0,0.4)");
		$(".dot").eq(i%5).addClass("active").siblings().removeClass("active");
	}
	var timer=setInterval(Banner,4000,1);
	$(".lbt").hover(function(){
		clearInterval(timer)
	},function(){
		timer=setInterval(Banner,4000,1);
	})
	// 小圆点点击
	
	$(".dot").click(function(){
		
		if(i==6){
			i=0;
			$("#lbt").stop().animate({"left":"0px"},0);
			
		}else{
			i=$(this).index();
		}
		Banner();
	})


var rec=[{src:"img/s1.webp",title:"有声漫《一禅小和尚》第一期看海"},{src:"img/s2.webp",title:"【old先】[19天]炸贱01 祝大家新年快乐"},{src:"img/s3.webp",title:"【有声漫画】现代纯爱爆笑漫画《爆炸吧，爸爸们》第四期"},{src:"img/s4.webp",title:"【我们】我家大师兄脑子有坑【第1-5坑】ED高虐注意！！！"}]

$.each(rec,function(i,e){
	$('<div class="recommend_channel_each"></div>').html('<img src="'+e.src+'" ><div class="recommend_channel_each_title">'+e.title+'</div>').appendTo($("#recommend_channel_main"))
})

// 最新动态
var obj=$.ajax({
	type:"get",
	url:"sound.json",
	async:false,
	success:function(response,status,xhr){
		console.log(response)
	}
})

function NewAct(obj){
	this.src=obj.src,
	this.title=obj.title,
	this.viewcount=obj.viewcount,
	this.commentcount=obj.commentcount
}

NewAct.prototype={
	init:function(e){
		$('<div class="frontpage-key-each"></div>').html('<img src="'+this.src+'" ><div class="frontpage-key-title">'+this.title+'</div><div class="frontpage-key-info">\
								<div class="viewcount">'+this.viewcount+'</div><div class="commentcount">'+this.commentcount+'</div></div>').appendTo($(".frontpage-key"))
	},
	init2:function(e){
		$('<div class="frontpage-key-each  frontsound-image"></div>').html('<img src="'+this.src+'" ><div class="frontpage-key-title">'+this.title+'</div><div class="frontpage-key-info">\
								<div class="viewcount">'+this.viewcount+'</div><div class="commentcount">'+this.commentcount+'</div></div>').appendTo($(".subcatalog-contant"))
	}
}

$.each(obj.responseJSON.data,function(i,e){
	var newact=new NewAct(e)
	newact.init();
})

// 排行榜
$(".fc-chooseitem>li").click(function(){
	$(this).toggleClass("change").siblings().removeClass("change")
	
})

function Ranking(i,obj){
	this.src=obj.src,
	this.title=obj.title,
	this.viewcount=obj.viewcount,
	this.commentcount=obj.commentcount,
	this.num=i+1
}

Ranking.prototype={
	init:function(i,e){
		$('<div class="right-content-each"></div>').html('<a href=""><div class="num">'+this.num+'</div>\
									<div class="cover"><img src="'+this.src+'" ></div>\
									<div class="weibo-title">'+this.title+'</div>\
									<div class="weibo-info">\
										<div class="viewcount">'+this.viewcount+'</div>\
										<div class="commentcount">'+this.commentcount+'</div></div></a>').appendTo($(".vw-catalogrank-inner"));
	}
}

$.each(obj.responseJSON.data2,function(i,e){
	// console.log(i,e)
	var ranking =new Ranking(i,e);
	ranking.init();

})
console.log($(".num"))

$(".num").each(function(i,e){
	console.log(i,e)
	if(i==0){
		$(this).css("background","#ffb938");
	}else if(i==1){
		$(this).css("background","#b1c3d6");
	}else if(i==2){
		$(this).css("background","#dac49a")
	}
})

// 音频热度
$.each(obj.responseJSON.data3,function(i,e){
	var newact=new NewAct(e)
	newact.init2();
})

